package asruby.lang
{
import asruby.Ruby;
import asruby.runtime.CallbackFactory;
import asruby.runtime.IRubyObject;
import asruby.runtime.ObjectAllocator;
	
public class RubyInteger  extends RubyNumeric
{
  	public static function  createIntegerClass(runtime: Ruby): RubyClass {
        var integer: RubyClass = runtime.defineClass("Integer", runtime.getNumeric(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        runtime.setInteger(integer);
        integer.kindOf =  function  isKindOf(obj: IRubyObject, type: RubyModule): Boolean {
                    return obj instanceof RubyInteger;                
            };

        var callbackFactory: CallbackFactory = runtime.callbackFactory(RubyInteger);
        integer.getSingletonClass().undefineMethod("new");

        integer.includeModule(runtime.getPrecision());
        
        integer.defineAnnotatedMethods(RubyInteger);
        integer.dispatcher = callbackFactory.createDispatcher(integer);
        
        return integer;
    }
    
    public function  RubyInteger(runtime: Ruby, rubyClass: RubyClass, useObjectSpace: Boolean)  {
        super(runtime, rubyClass, useObjectSpace);
    }

    public override function  convertToInteger(): RubyInteger {
    	return this;
    }

}
}